#1098 Report the true watch mode when the events directory is missing - #1101
Merged
Conversation
Dependency auditProduction dependency audit passed. |
williamthorsen
marked this pull request as ready for review
July 28, 2026 18:09
Fleet's startup line names the watch mode actually in effect on every platform. On Linux, a missing events directory left it announcing an active recursive watch that had never started, and no later message corrected it. The degraded-mode line names the directory that could not be watched and the underlying reason.
The watcher's announcement and degradation behavior is exercisable without an OS-level watch. Tests supply their own watch starter, and the module falls back to Node's recursive `fs.watch` when none is given. Coverage now includes a watch that fails to start, and pins that a missing directory is detected before any watch is attempted.
The watcher suite covers a burst of watch events collapsing into a single dirty signal, and an error from the watch downgrading to rescan-only and releasing the handle. Only the test asserting the default watch mode starts a real OS-level watch; the rest drive the module through an injected starter.
The watcher suite's temp directory and running watchers are created and released per test, by helpers that register their own teardown. Module-level mutable state, `beforeEach`, and `afterEach` leave the file, and with them the three lint warnings it carried.
The burst test waits for the dirty signal itself rather than for a fixed interval long enough to contain it, so a garbage-collection pause or a loaded runner cannot fail it with zero calls.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes an issue on Linux where Fleet's startup line claimed an active watch on its events directory even when that directory did not exist. The line now reports when Fleet is falling back to periodic rescans instead, naming the directory it could not watch and the reason.
Why
The startup line is the operator's only signal for whether low-latency updates are in effect, and the module's stated contract is that a fallback to periodic rescans is always announced. On Linux that promise was not being kept, and it was the watcher suite's failure on CI that surfaced it.
Details
🐛 Bug fixes
♻️ Refactoring
startWatcherresolves its watch through an injectable starter, matching the seams already used bycreateGitAdapterandcreateGithubAdapter. Production omits it and takes the default.🧪 Tests
Closes #1098